/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import { initByProject, initExecuteCommand, runHvigor } from '../src/common/common';

describe('test invalid module', () => {
  test.concurrent('test -p', async () => {
    await initByProject('common-test', async (rootProject) => {
      const command = initExecuteCommand({
        tasks: 'tasks',
        module: 'exxxtry'
      });

      try {
        await runHvigor(rootProject, command);
      } catch (e: any) {
        expect(e.stderr).toContain('BUILD FAILED');
        expect(e.stderr).toContain('Unknown module \'exxxtry\' in the command line');
        expect(e.stderr)
          .toContain('Make sure \'exxxtry\' module is set at the modules field in the build-profile.json5 file.');
      }
    });
  });

});
